package cn.zswltech.gruul.biz.comparator;

import cn.zswltech.gruul.common.entity.CustomTreeDO;

import java.util.Comparator;

public class CustomTreeDOComparator implements Comparator {
    @Override
    public int compare(Object arg0, Object arg1) {
        CustomTreeDO customTreeDO1 = (CustomTreeDO) arg0;
        CustomTreeDO customTreeDO2 = (CustomTreeDO) arg1;
        if (customTreeDO1.getSortNo() == null) {
            return -1;
        } else if (customTreeDO2.getSortNo() == null) {
            return 1;
        } else {
            int result = customTreeDO1.getSortNo().compareTo(customTreeDO2.getSortNo());
            if (result == 0) {
                return customTreeDO1.getGmtCreate().compareTo(customTreeDO2.getGmtCreate());
            } else {
                return result;
            }
        }
    }
}
